<template>
<div>
  <van-circle
      v-model:current-rate="currentRate"
      :rate="100"
      :speed="10"
      :text="msg"
      @click="tz"
  />
</div>
</template>

<script setup>
import {ref,onMounted} from 'vue'
import {useStore} from "vuex";
import {useRouter} from "vue-router";

const store=useStore()
const router = useRouter()
const  msg=ref("跳过10秒");
const currentRate=ref(0);
const  second=ref(10);

onMounted(()=>{
  var t=setInterval(()=>{
    if(second.value>1){
      currentRate.value=currentRate.value+10;
      console.log(currentRate.value)
      second.value--;
      msg.value="跳过"+second.value+"秒";

      console.log(second.value)
    }else {
      clearInterval(t);
      tz()
    }
  },1000)
})
const tz = () => {
  //跳转页面
  if(store.state.token.length>0){
    //有令牌 跳转主页
    router.push("/index")
  }else {
    router.push("/login");
  }
}
</script>

<style scoped>

</style>
